package com.zhq.blog.core.domain.game.support;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.zhq.blog.core.domain.game.support.AutoBetBase.RunningState;

/**
 * @title:PermutationBetRepository.java
 * @package com.zhq.blog.core.domain.game.support
 * @author 张恒强
 * @date 2014年12月26日 下午2:23:58
 * @version V1.0
 */
public interface PermutationBetRepository extends AutoBetBaseRepository<PermutationBet>{
	
	@Query("select p from PermutationBet p where p.deleted = 0 and p.gameId = :gameId and p.startBetPeriod <= :period and p.state = :state")
	List<PermutationBet> find_by_game_period_running(@Param("gameId") long gameId,@Param("period") long period,@Param("state") RunningState state);
	
	@Query("select pb from PermutationBet pb where pb.deleted = 0 and pb.gameId = :gameId and pb.userId = :userId")
	List<PermutationBet> find_by_game_user(@Param("gameId") long gameId,@Param("userId")long userId);
}
